<!-- put this at the top of the page -->
<?php
/*
   $mtime = microtime();
   $mtime = explode(" ",$mtime);
   $mtime = $mtime[1] + $mtime[0];
   $starttime = $mtime;
*/
?> 

<?php
require_once '../../../wp-blog-header.php';
include_once('ses.php');
$con=new SimpleEmailService("AKIAJEB25SWREHIRO2YA","Ota+tmICcb0aX+438v1fjmNizdCzlA/fzYr+G8cy");
$con->listVerifiedEmailAddresses();
//echo "<pre>";
//print_r($con->getSendQuota());
//echo "<pre>";
//exit();
//$con->verifyEmailAddress('kumaril@enthrallmedia.com');
//exit();

$date = date('Y-m-d');
$date = '%'.$date.'%';

$users_pod = new Pod('users');
$users_pod->page =14;
$users_pod->search = false;
$where = "t.daily_newsletter=0";
$users_pod->findRecords('id DESC', 200,$where);
$usersFound = $users_pod->getTotalRows();
echo $usersFound;
//exit();

unset($users_array);

$i=0;
while($users_pod->fetchRecord()){
$users_array[$i]['email'] = $users_pod->get_field('wp_user.user_email');
$users_array[$i]['name'] = $users_pod->get_field('name');
$i++;
}


//echo count($users_array);
//echo "<pre>";
//print_r($users_array);
//exit();


if(count($users_array) > 0)
{

foreach($users_array as $k_users=>$v_users){
  $utime = microtime();
  $utime = explode(" ",$utime);
  $utime = $utime[1] + $utime[0];
  $ustarttime = $utime;
  
    $m = new SimpleEmailServiceMessage();
    $m->addTo($v_users['email']);
    //$m->addTo('chetan.bhatia@enthrallmedia.com');
    $m->setFrom('Buzzr.in<info@enthrallmedia.com>');
    $m->setSubject('Beat the heat with cool deals from Buzzr.in.');
    $m->setReturnPath('kumaril@enthrallmedia.com');
  
    unset($html);
    $html = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  <html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <title></title>
  </head>
  <body>
       <div id="maincontent" style="height: 100%; margin: auto; text-align: center; width: 620px;">
           <a href="http://buzzr.in/?utm_source=weekly%2Bnewletter&utm_medium=emailer&utm_term=featuresnews&utm_content=weeklynewsletter&utm_campaign=weeklynewsletter"><img src="http://buzzr.in/wordpress/wp-content/plugins/buzzr_newsletter/images/newsletter.jpg" width="600px" height="600px" alt="Beat the heat this summer with attractive deals and exciting new features on Buzzr.in "/></a>';
                       
     
    
    $html .= '</div></body></html>';  
    
   // print_r($html);
  //  exit();
    
   $m->setMessageFromString('',$html);
   $con->sendEmail($m);
   
}
	//echo "<pre>";
   // print_r($con->getSendStatistics());
   // echo "<pre>";
}

?>
